package 开始的剑指offer8月.面经常用算法题09开始的;

import java.util.Arrays;

// https://leetcode-cn.com/problems/smallest-k-lcci/
public class 面试题1714最小K个数0903 {

        public int[] smallestK(int[] arr, int k) {
            Arrays.sort(arr);
            int newArray[]=new int[k];
            for(int i=0;i<newArray.length;i++){
                newArray[i]=arr[i];
            }
            return newArray;
        }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new 面试题1714最小K个数0903().smallestK(new int[]{1,3,5,7,2,4,6,8},4))) ;

    }
}
